"""
author: Jackson Black
time: 2023-08-20 14-21-14 
"""


class Person(object):

    def __init__(self, name, age):
        self._name = name
        self._age = age

    @property
    def name(self):
        return self._name

    @property
    def age(self):
        return self._age

    @name.setter
    def name(self, name):
        self._name = name

    @age.setter
    def age(self, age):
        self._age = age

    def fm(self):
        print("父类方法。。。")


# 继承 Person 类
class Student(Person):

    def __init__(self, name, age, score):
        # 调用父类的构造器构造父类对象
        super().__init__(name, age)
        self._score = score

    @property
    def score(self):
        return self._score

    @score.setter
    def score(self, score):
        self._score = score

    def fm(self):
        print("子类的方法")


def extends_():
    p = Person("Jason", 21)
    print(f'p={p.name},{p.age}')
    p.fm()
    s = Student("Black", 22, "male")
    print(f's={s.name},{s.age},{s.score}')
    s.fm()


if __name__ == "__main__":
    extends_()
